package com.scu.phototabuser.ui.taskgroup;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by tianfei on 2017/5/23.
 */

public enum ImageType {
    TYPE_GOODS(10,"物品"),
    TYPE_LIFE_ABOUT(11,"生活"),
    TYPE_SCENERY(12,"风景"),
    TYPE_CITY_ABOUT(13, "城市"),
    TYPE_ANIMALS(14,"动物");

    ;

    private static Map<Integer,String> parseMapI2S =new HashMap<>();
    private static Map<String,Integer> parseMapS2I =new HashMap<>();
    static {
        for (ImageType i: ImageType.values()){
            parseMapI2S.put(i.getType(),i.getMsg());
            parseMapS2I.put(i.getMsg(),i.getType());
        }
    }

    private Integer type;
    private String msg;
    ImageType(int type,String msg) {
        this.type=type;
        this.msg=msg;
    }

    public Integer getType() {
        return type;
    }

    public String getMsg() {
        return msg;
    }

    public static String getMsgFromType(Integer type){
        return parseMapI2S.get(type);
    }
    public static Integer getIntFromMsg(String msg){
        return parseMapS2I.get(msg);
    }

}
